//
//  EFANoticeTCell.m
//  efairy
//
//  Created by XiangDongMBP on 2017/8/29.
//  Copyright © 2017年 East. All rights reserved.
//

#import "EFANoticeTCell.h"
#import "EFAModel.h"
#import "NSString+XDNSDate.h"
#import "NSDate+XDTimerFormatter.h"
#import "UIColor+XDHex.h"
#import "GlobalHeader.h"

@implementation EFANoticeTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.redPointView.layer.masksToBounds = YES;
    self.redPointView.layer.cornerRadius = CGRectGetWidth(self.redPointView.bounds) / 2.0;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configViewWithListItem:(EFANotListItem *)item {
    self.titleLabel.text = item.efairyannouncement_title;
    self.contentLabel.text = item.efairyannouncement_content;
    self.contentLabel.numberOfLines = 5;
    NSDate *date = [item.efairyannouncement_add_time xd_yyyyMMddHHmmssStrToDate];
    self.timeLabel.text = [NSString stringWithFormat:@"%@ %@", item.efairyannouncement_publisher_nickname, [date xd_yyyy_MM_ddHHmm]];
    self.redPointView.hidden = item.efairyuserhasannouncement_is_read;
    if (!item.efairyuserhasannouncement_is_read) {
        self.titleLabel.textColor = [UIColor xd_colorWithHex:EFAGlobalColorFontDarkBlack];
        self.contentLabel.textColor = [UIColor xd_colorWithHex:EFAGlobalColorFontMidBlack];
    } else {
        self.titleLabel.textColor = [UIColor xd_colorWithHex:EFAGlobalColorFontLightBlack];
        self.contentLabel.textColor = [UIColor xd_colorWithHex:EFAGlobalColorFontLightBlack];
    }
}

@end


@implementation EFANoticeTCell (NoticeDetail)
- (void)configViewInDetailWithListItem:(EFANotListItem *)item {
    self.titleLabel.text = item.efairyannouncement_title;
    self.contentLabel.text = item.efairyannouncement_content;
    self.contentLabel.numberOfLines = 0;
    NSDate *date = [item.efairyannouncement_add_time xd_yyyyMMddHHmmssStrToDate];
    self.timeLabel.text = [NSString stringWithFormat:@"%@ %@", item.efairyannouncement_publisher_nickname, [date xd_yyyy_MM_ddHHmm]];
    self.redPointView.hidden = YES;
}
@end

